cssimage: Fix cross-fade
authorBenjamin Otte <otte@redhat.com>
Wed, 11 Jan 2017 01:51:50 +0000 (02:51 +0100)
committerBenjamin Otte <otte@redhat.com>
Wed, 11 Jan 2017 01:53:12 +0000 (02:53 +0100)
Simgle image cross-fade opacity was computed the wrong way, which caused
weird fade-in/out animations, for example in flat buttons.

I messed this up when porting cross-fades to snapshot().

gtk/gtkcssimagecrossfade.c

index 546c2724fe3bf20532bbf2e591828307f98ee4d1..60e922480e3a7610acc14de8e383ca13907765e4 100644 (file)
@@ -150,14 +150,14 @@ gtk_css_image_cross_fade_snapshot (GtkCssImage *image,
         }
       else if (start_node)
         {
-          gtk_snapshot_push_opacity (snapshot, cross_fade->progress, "CrossFadeStart");
+          gtk_snapshot_push_opacity (snapshot, 1.0 - cross_fade->progress, "CrossFadeStart");
           gtk_snapshot_append_node (snapshot, start_node);
           gtk_snapshot_pop_and_append (snapshot);
           gsk_render_node_unref (start_node);
         }
       else if (end_node)
         {
-          gtk_snapshot_push_opacity (snapshot, 1.0 - cross_fade->progress, "CrossFadeEnd");
+          gtk_snapshot_push_opacity (snapshot, cross_fade->progress, "CrossFadeEnd");
           gtk_snapshot_append_node (snapshot, end_node);
           gtk_snapshot_pop_and_append (snapshot);
           gsk_render_node_unref (end_node);